home *** CD-ROM | disk | FTP | other *** search
- ; Test program for !FasterPC
- ; Copyright D.J.Lawrence, 1993
- ;
- ; This test program loads a VGA mode 13 screen and scrolls
- ; it horizontally, as fast as it can. The program continues
- ; until the screen has scrolled once or until the user
- ; presses any key.
-
- Code_Seg SEGMENT PUBLIC
-
- ASSUME CS:Code_Seg
- ORG 00100H ; Produce a '.COM' executable
-
- MOV AX,0013H
- INT 10H ; Mode 13H (VGA 256 colours)
- MOV AX,3D00H
- PUSH CS
- POP DS
- MOV DX,OFFSET PalName
- INT 21H ; Open palette file
- MOV FHandle,AX
- MOV BX,FHandle
- MOV AX,3F00H
- MOV CX,0300H ; Read 768 bytes (3 registers * 256 colours)
- MOV DX,OFFSET DataArea
- INT 21H ; Read palette file into memory
- MOV BX,FHandle
- MOV AX,3E00H
- INT 21H ; Close palette file
-
- ; Convert 8 bit palette values to 6 bit values by shifting right 2
- PUSH CS
- POP DS
- MOV SI,OFFSET DataArea
- MOV CX,0300H
- ModLP1: MOV AL,[SI]
- SHR AL,1
- SHR AL,1
- MOV [SI],AL
- INC SI
- LOOP ModLP1
-
- ; Update palette registers with shifted palette values
- MOV AX,1012H
- MOV BX,0000H
- MOV CX,0100H
- PUSH CS
- POP ES
- MOV DX,OFFSET DataArea
- INT 10H
-
- ; Load picture file into video memory
- PUSH CS
- POP DS
- MOV AX,3D00H
- MOV DX,OFFSET PicName
- INT 21H ; Open picture file
- MOV FHandle,AX
- MOV BX,FHandle
- MOV AX,0A000H
- PUSH AX
- POP DS
- MOV AX,3F00H
- MOV CX,0FA00H ; Read 64000 bytes
- MOV DX,0000H
- INT 21H ; Read picture file into video memory
- MOV BX,FHandle
- MOV AX,3E00H
- INT 21H ; Close picture file
-
- ; Perform the screen scroll for 320 pixels
- ; or until the user presses a key
- ; Initialise the 320 counter
- MOV BX,0140H
- ; First store the left most pixel column
- LScroll: MOV AX,0A000H
- PUSH CS
- PUSH AX
- POP DS ; DS = A000
- POP ES ; ES = CS
- MOV SI,0000H
- MOV DI,OFFSET DataArea
- MOV CX,00C8H ; Repeat for all 200 screen pixel lines
- MovLP1: MOVSB
- ADD SI,013FH ; Move source to start of next pixel row
- LOOP MovLP1
- ; Next scroll the whole screen left by one pixel
- MOV AX,0A000H
- PUSH AX
- POP ES ; ES = A000
- MOV SI,0001H
- MOV DI,0000H
- MOV CX,08000H
- REP MOVSW ; Scroll using word move for max efficiency
- ; Restore the right most pixel column
- MOV AX,0A000H
- PUSH AX
- PUSH CS
- POP DS ; DS = CS
- POP ES ; ES = A000
- MOV SI,OFFSET DataArea
- MOV DI,013FH
- MOV CX,00C8H
- MovLP2: MOVSB
- ADD DI,013FH
- LOOP MovLP2
-
- ; See if the 320 columns have been completed
- DEC BX
- CMP BX,0000H
- JE Quit2
-
- ; See if user wants to exit
- MOV AX,0100H
- INT 16H ; Has a key has been pressed ?
- JNE Quit1 ; Yes - jump
- JMP LScroll ; No - continue scroll
- Quit1: MOV AX,0000H
- INT 16H ; Read the detected key
- Quit2: MOV AX,0003H
- INT 10H ; Mode 3 (CGA colour text)
- RET
-
- FHandle DW ?
- PalName DB 'VGA.PAL',0
- PicName DB 'VGA.PIC',0
- DataArea DB 768 DUP ?
-
- Code_Seg ENDS
-